home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 42 / Amiga Format AFCD42 (Issue 126, Aug 1999).iso / -serious- / programming / basic / blitzandpieces / reflux.asc < prev    next >
Encoding:
Text File  |  1999-05-14  |  2.3 KB  |  85 lines

  1. ; flushes memory every x seconds (from CLI, default 10)
  2.  
  3. ; NOTE - beta!
  4.  
  5. ; You WILL probably get weird crashes, but read this :
  6.  
  7. ; Currently, you'll have to add programs on your system to the
  8. ; list at the very bottom. This is because some programs don't
  9. ; seem to like having memory flushed so often (especially MUI
  10. ; apps). IMPORTANT - if you add or remove programs, adjust the
  11. ; "progs" variable to the correct number!
  12.  
  13. ; ReFluX just avoids flushing while these programs are running...
  14.  
  15. ; It's very stable on my system with the programs below ignored,
  16. ; and I have my full memory available even after running Voyager
  17. ; and stuff like that :)
  18.  
  19. ; There are docs in Aminet/util/misc/ReFluX.lha (think that's right)
  20. ; but that version doesn't ignore any programs at all...
  21.  
  22. ; version string :
  23.  
  24. v$="$VER: ReFluX 1.0b (19.2.1998) James L Boyd"
  25.  
  26. del.w=10                                          ; default delay between
  27.                                                   ; flushes
  28.  
  29. If NumPars=1                                      ; CLI parameters (delay)
  30.  
  31.   a$=Par$(1)                                      ; use only 1st parameter
  32.  
  33.   If a$="?" OR a$="help" OR a$="-h"               ; do help, quit
  34.     a$="Usage : ReFlux <delay in 1-300 seconds>"
  35.     PutStr_ &a$
  36.     End
  37.   EndIf
  38.  
  39.   del=Val(a$)                                     ; turn into user's
  40.   If del<1 OR del>300 Then del=10                 ; delay value
  41.  
  42. EndIf
  43.  
  44. del*50                                            ; multiply by ticks
  45.  
  46. progs.b=6                                         ; no of bad programs!
  47.  
  48. WBStartup                                         ; run from icon, too
  49.  
  50. loop
  51.  
  52. error.b=0
  53.  
  54.   ; ctrl-c check :
  55.  
  56.   If (SetSignal_(0,#SIGBREAKF_CTRL_C) & #SIGBREAKF_CTRL_C) Then End
  57.  
  58.   Delay_ del                                      ; wait for delay time
  59.  
  60. Restore strings
  61.  
  62. For a.b=1 To progs
  63.   Read t$
  64.   If error=0
  65.     If FindTask_(&t$) Then error=1                ; don't flush!
  66.   EndIf
  67. Next a
  68.  
  69. If error=0
  70.  
  71.     For a=1 To 10
  72.       AllocMem_ $7ffffff0,#MEMF_PUBLIC            ; flush ten times :
  73.     Next a                                        ; this is how "avail
  74.                                                   ; flush" does it...
  75. EndIf
  76.  
  77. Goto loop
  78.  
  79. ; Don't flush while these programs are running :
  80. ; NOTE - make sure "progs" variable is set to the
  81. ; number of items below!!!
  82.  
  83. strings:
  84. Data$ "V","Miami","YAM","MCDPlay","MCDPlayer","Blitz2"
  85.